﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CToolsWin.DB
{
    public partial class SQLInfo : Form
    {
        public SQLInfo()
        {
            InitializeComponent();
        }
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            DataTable dt = new BLL.BLLSQLInfo().GetInfo(txtSQLConn.Text);
            DataTable dtInfo = new DataTable();
            dtInfo.Columns.Add("属性", typeof(string));
            dtInfo.Columns.Add("属性值", typeof(string));

            DataRow row = dtInfo.NewRow();
            row[0] = "文件名称";
            row[1] = dt.Rows[0]["fileName"];
            dtInfo.Rows.Add(row);
            row = dtInfo.NewRow();
            row[0] = "文件设置大小(MB)";
            row[1] = dt.Rows[0]["fileSize"];
            dtInfo.Rows.Add(row);
            row = dtInfo.NewRow();
            row[0] = "文件所占空间(MB)";
            row[1] = dt.Rows[0]["fileUsedSize"];
            dtInfo.Rows.Add(row);
            row = dtInfo.NewRow();
            row[0] = "所占空间率(%)";
            row[1] = dt.Rows[0]["fileUsedSizeRatio"];
            dtInfo.Rows.Add(row);
            row = dtInfo.NewRow();
            row[0] = "增长模式";
            row[1] = dt.Rows[0]["increaseType"];
            dtInfo.Rows.Add(row);
            row = dtInfo.NewRow();
            row[0] = "增量模式";
            row[1] = dt.Rows[0]["incrementType"];
            dtInfo.Rows.Add(row);
            row = dtInfo.NewRow();
            row[0] = "增长值(%或MB)";
            row[1] = dt.Rows[0]["increaseValue"];
            dtInfo.Rows.Add(row);
            row = dtInfo.NewRow();
            row[0] = "文件所在目录";
            row[1] = dt.Rows[0]["fileDirectory"];
            dtInfo.Rows.Add(row);
            row = dtInfo.NewRow();
            row[0] = "文件类型";
            row[1] = dt.Rows[0]["fileType"];
            dtInfo.Rows.Add(row);

            dgvSQLInfo.DataSource = dtInfo;
            dgvSQLInfo.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
            dgvSQLInfo.ColumnHeadersDefaultCellStyle.WrapMode = DataGridViewTriState.False;
        }
    }
}
